package sft.Autenticacao.Login;

import java.util.List;
import sft.Autenticacao.Login.Logica.Login;

public class LoginControle extends LoginDao {

    public LoginControle() {
    }

    public void Adicionar(Login l) {
        l.setSql("INSERT INTO sft.sft_usua (usua_nm_nmusua, usua_sn_snusua, fk_perfil) "
                + "	VALUES (?, ?, ?)");
        l.setOperacao("adicionar");
        Operacao(l);
    }

    public void Editar(Login l) {
        l.setSql("UPDATE sft.sft_usua SET `usua_nm_nmusua` = ?, `usua_sn_snusua` = ?, `fk_perfil` = ? "
                + " WHERE usua_id_idusua like ?");
        l.setOperacao("editar");
        Operacao(l);
    }

    public void Deletar(Login l) {
        l.setSql("DELETE FROM sft.sft_usua WHERE usua_id_idusua like ?");
        l.setOperacao("deletar");
        Operacao(l);
    }

    @Override
    public List<Login> getList(Login l, boolean nome) {
        l.setSql("select * from sft_usua order by usua_nm_nmusua");
        if (nome) {
            l.setSql("select * from sft_usua where like ?");
        }
        return super.getList(l, nome); //To change body of generated methods, choose Tools | Templates.
    }
}
